package xx.iverson.controller;


import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xx.iverson.dto.add.SyUserAddDto;
import xx.iverson.dto.request.SyUserRequestDto;
import xx.iverson.result.ReturnResult;
import xx.iverson.service.SyUserService;

/**
 * xx.iverson.controller.SyUserController
 * 用户控制器
 * on 2025/6/18-下午3:09
 *
 * @author weijx
 */
@Slf4j
@RestController
@RequestMapping("/api/user")
@Validated
public class SyUserController {

    @Autowired
    private SyUserService userService;

    @PostMapping("/register")
    public ReturnResult<?> register(@Valid @RequestBody SyUserAddDto addDto) {
        return userService.register(addDto);
    }

    @PostMapping("/login")
    public ReturnResult<?> login(@Valid @RequestBody SyUserRequestDto requestDto) {
        return userService.login(requestDto);
    }

}